
import { message } from 'antd';

const showMessage = (type: 'success' | 'error' | 'warning' | 'info', content: string, duration = 3) => {
    message.open({
        type,
        content,
        duration,
    });
};

(window as any).$message = {
    success: (content: string, duration?: number) => showMessage('success', content, duration),
    error: (content: string, duration?: number) => showMessage('error', content, duration),
    warning: (content: string, duration?: number) => showMessage('warning', content, duration),
    info: (content: string, duration?: number) => showMessage('info', content, duration),
};